package com.pn.controller;

import com.pn.entity.OutStore;
import com.pn.entity.Store;
import com.pn.service.OutstoreService;
import com.pn.service.ProductService;
import com.pn.service.StoreService;
import com.pn.utils.PageBean;
import com.pn.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("outstore")
public class OutstoreController {

    @Autowired
    private OutstoreService outstoreService;

  /*  @Autowired
    private ProductService productService;*/
    @Autowired
    private StoreService storeService;

    //添加出库单
    @PostMapping("outstore-add")
    public Result outstoreAdd(@RequestBody OutStore outStore){
        return outstoreService.saveOutSore(outStore);
    }

  //查询仓库
  @GetMapping("/store-list")
  public Result sotreList(){
      List<Store> storeList = storeService.storeList();
      return Result.ok(storeList);
  }

    //显示出库列表
    @GetMapping("/outstore-page-list")
    public Result outstorePageList(OutStore outStore){
       PageBean<OutStore> pageBean =  outstoreService.outstorePageList(outStore);
        return Result.ok(pageBean);
    }

    //确认出库
    @PutMapping("/outstore-confirm")
    public Result outstoreConfirm(@RequestBody OutStore outStore){
        return outstoreService.outstoreConfirm(outStore);
    }
}
